package com.zhuoyue.system.domain.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhuoyue.common.annotation.Excel;
import com.zhuoyue.system.domain.TblGroup;
import com.zhuoyue.system.domain.vo.TblGatewayVo;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.List;

/**
 * 群组信息
 *
 * @author wjming
 * @date 2021-09-06
 */
@Data
public class GroupRepDTO {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private String id;

    /**
     * 用户手机号
     */
    @Excel(name = "手机号")
    private String account;

    /**
     * 网关MAC地址
     */
    @Excel(name = "所属网关")
    private String gatewayMac;

    /**
     * 家庭ID
     */
    @Excel(name = "所属家庭")
    private String homeName;

    /**
     * 群组名称
     */
    @Excel(name = "群组名称")
    private String name;

    /**
     * 群组类型
     */
    @Excel(name = "群组类型")
    private String type;

    /**
     * 群组编号
     */
    @Excel(name = "群组编号")
    private String code;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date modifyTime;
    /**
     * 设备列表
     */
    List<BaseDeviceMessage> deviceList;
    /**
     * 网关信息
     */
    private TblGatewayVo gatewayVo;
    /**
     * 部门Id
     */
    private Long deptId;
    /**
     * 部门名称
     */
    @Excel(name = "所属组织")
    private String deptName;

    public GroupRepDTO doToDto(TblGroup group) {
        BeanUtils.copyProperties(group, this);
        return this;
    }
}
